# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gnome-shortwave
pkgver=3.2.0
pkgrel=2
pkgdesc="Listen to internet radio"
url="https://gitlab.gnome.org/World/Shortwave"
arch="all"
license="GPL-3.0-only"
depends="
	gst-libav
	gst-plugins-bad
	gst-plugins-good
	"
makedepends="
	cargo
	curl-dev
	desktop-file-utils
	glib-dev
	gst-plugins-bad-dev
	gst-plugins-base-dev
	gstreamer-dev
	gtk4.0-dev
	libadwaita-dev
	libshumate-dev
	meson
	openssl-dev>3
	sqlite-dev
	"
checkdepends="
	appstream-glib
	xvfb-run
	"
source="https://gitlab.gnome.org/World/Shortwave/uploads/823870933d66693170571fdf09f2e355/shortwave-$pkgver.tar.xz
	lfs64-libc.patch
	lfs64-getrandom.patch
	"
subpackages="$pkgname-lang"
builddir="$srcdir/shortwave-$pkgver"
options="net"

prepare() {
	sed -i -e 's/\("files":{\)[^}]*/\1/' \
		vendor/libc/.cargo-checksum.json \
		vendor/getrandom/.cargo-checksum.json
	default_prepare
}

build() {
	abuild-meson . output
	meson compile -C output
}

check() {
	xvfb-run -a meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
c6ec78f65d32a98cc213fec2e3a6f872a2ea721e2d91358e7e5bd2c37e871515f3628db78cae84e388075ac7393faebce0598462012c6f53432858c13064a4b0  shortwave-3.2.0.tar.xz
3ae8b2dbba84a4a4b8e10b58531e6b182028f246270fcf8b19f3b4758bbf0008bc17eeec1b1ad3d5aa9c5ae7a9aa9484c822ca33b73543d36c06592699c402cb  lfs64-libc.patch
7b097b4f4e074f8bc4983aae228d4b891121d96a9420b9240cfdea547dbc1d06134c806b59188e76a387da9aa098c1cc273233646fb7c109fcf369907f0ffcec  lfs64-getrandom.patch
"
